package dataflow.example;

import org.apache.log4j.Logger;

public class FileStorage {

	static Logger log = Logger.getLogger(FileStorage.class);
	
	public Integer run(Integer portSetNumber){
		log.info("FileStorage - running portset " + portSetNumber);
		if(portSetNumber == 1){
			try{
				log.info("FileStorage: WAITING");
//				Thread.sleep(4000);
//				long num = 0;
//				for(int k = 0; k < 1000000; k++){
//					for(int i = 0; i < 1000; i++){
//						num = 99 * i;
//					}
//				}
//				log.info(num);
				log.info("FileStorage: WAITING ended");
			}catch(Exception e){
				e.printStackTrace();
			}
			return 3;
		} else {
			return -1;
		}
	}
	
	public void start(){
		log.info("Initializing FileStorage");
	}
	
	public void stop(){
		log.info("Ending FileStorage");
	}
	
	public void setsaveStart(){
		log.info("File Storage: saveStart.");
	}
	
	public Object getgetTime(){
		return "file storage time";
	}
	
	public void setsaveString(Object o){
		log.info("FileStorage: setting saveString: " + (String)o);
	}
}
